package domain;

import java.io.Serializable;
import javax.persistence.*;


/**
 * The persistent class for the land database table.
 * 
 */
@Entity
@Table(name="land")
@NamedQueries({
    @NamedQuery(name = "Land.findAll", query = "SELECT l FROM Land l ORDER BY l.land"),
    @NamedQuery(name = "Land.findByLandId", query = "SELECT l FROM Land l WHERE l.landId = :land_id"),
    @NamedQuery(name = "Land.findByContinentId", query = "SELECT l FROM Land l WHERE l.continent.continentId = :continent_id")})
public class Land implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name="land_id", unique=true, nullable=false)
	private int landId;

	@Column(nullable=false, length=50)
	private String land;

	//bi-directional many-to-one association to Continent
    @ManyToOne
	@JoinColumn(name="continent_id", nullable=false)
	private Continent continent;

    public Land() {
    }

	public int getLandId() {
		return this.landId;
	}

	public void setLandId(int landId) {
		this.landId = landId;
	}

	public String getLand() {
		return this.land;
	}

	public void setLand(String land) {
		this.land = land;
	}

	public Continent getContinent() {
		return this.continent;
	}

	public void setContinent(Continent continent) {
		this.continent = continent;
	}

	@Override
	public boolean equals(Object obj) {
		return (obj!=null && obj instanceof Land && ((Land)obj).getLandId()==getLandId());
	}

	@Override
	public String toString() {
		return getLand();
	}
}